<template>
  <div class="model">
    <list class="modelList">
        <cell class="modelListItem" v-for="(item, index) in modelData" :key="index" @click="addClassFun(item)" :class="[model === item.SBLX_ID ? 'active' : '']">
          <text class="text" :class="[model === item.SBLX_ID ? 'active' : '']">{{item.NAME}}</text>
        </cell>
      </list>
  </div>
</template>
<script>
import store from '@/store/dmHome'

export default {
  name: 'model',
  beforeCreate() {
      this.$notice.loading.show()
  },
  created () {
    store.dispatch('getSBXH', this)
  },
  methods: {
    addClassFun (item) {
      store.commit('changeModel', item.SBLX_ID)
      store.dispatch('getAzddList', this)
      this.$emit('closeList')
    }
  },
  computed: {
    model () {
      return store.state.model
    },
    modelData () {
      return store.state.modelData
    }
  }
}
</script>
<style scoped>
.model{
  width: 750px;
  background-color: rgba(0, 0, 0, 0.4);
  flex: 1;
}
.modelList{
  width: 750px;
}
.modelListItem{
  width: 750px;
  height: 100px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding-left: 20.8px;
  padding-right: 20.8px;
  border-bottom-color: #eee;
  border-bottom-style: solid;
  border-bottom-width: 1px;
  background-color: white;
}
.text{
  font-size: 29.1px;
  font-family:PingFangSC-Regular;
  color:rgba(102,102,102,1);
}
.active{
  color: #fff;
  background-color: rgba(62,175,252,1);
}
</style>